Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit e5dfa81b0a3e83d457e6e3087e74f58ae92b0f26


Parents : 00b9517
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-11-04T15:26:00+01:00

Implemented Kivy/SDL2 workaround for slow window resize updates on Linux

Changes

1 files changed, 32 insertions(+), 0 deletions(-)


Diff

diff --git a/sbapp/main.py b/sbapp/main.py
index 371ce5fb..e128ec68 100644
--- a/sbapp/main.py
+++ b/sbapp/main.py
@@ -133,6 +133,36 @@ def apply_ui_scale():
except Exception as e:
RNS.log(f"Error while reading saved window configuration: {e}", RNS.LOG_ERROR)
+###################################################
+# Kivy/SDL2 run-time patch to fix horribly slow
+# window resize updates on Linux. For more info:
+# https://github.com/kivy/kivy/issues/9106
+#
+_sdl2_window_event_filter_original = None
+_sdl2_window_event_filter_instance = None
+def _sdl2_window_event_filter_proxy(action, *largs):
+ global _sdl2_window_event_filter_original
+ global _sdl2_window_event_filter_instance
+ if not action == 'windowresized': return _sdl2_window_event_filter_original(action, *largs)
+ else:
+ _sdl2_window_event_filter_instance._size = largs
+ _sdl2_window_event_filter_instance._win.resize_window(*_sdl2_window_event_filter_instance._size)
+ # The only change this patched method makes is to
+ # remove the offending "EventLoop.idle()" statement
+ # EventLoop.idle()
+ return 0
+
+def patch_sdl_window_events(patch_target):
+ if RNS.vendor.platformutils.is_linux():
+ global _sdl2_window_event_filter_original
+ global _sdl2_window_event_filter_instance
+ _sdl2_window_event_filter_original = patch_target._event_filter
+ _sdl2_window_event_filter_instance = patch_target
+ patch_target._event_filter = _sdl2_window_event_filter_proxy
+ patch_target._win.set_event_filter(patch_target._event_filter)
+#
+# End of Kivy/SDL2 patch ##########################
+
if args.export_settings:
from .sideband.core import SidebandCore
sideband = SidebandCore(
@@ -1531,6 +1561,8 @@ class SidebandApp(MDApp):
Window.bind(on_minimize=self.on_minimize)
Window.bind(on_restore=self.on_restore)
+ patch_sdl_window_events(Window)
+
if __variant__ != "":
variant_str = " "+__variant__
else:


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────